package com.rd.student.dashuju.sunwenzhuo.day0731;

import java.util.Arrays;

public class Test2 {
    public static void main(String[] args) {
        int[] arr = new int[20];

        for (int i = 0; i < 20; i++) {
            int num = (int)(Math.random()*50);
            boolean flag = false;
            for (int j = 0; j < i; j++) {
                if (num == arr[j]) {
                    flag = true;
                    break;
                }
            }
            if (!flag){
                arr[i]=num;
            }
            if (flag){
               i--;
               continue;
            }
        }
        System.out.println(Arrays.toString(arr));
    }
}
